$(function () {
    var opt1 = {
        legend: [{
            text: "",
            name: "1",
            icon: "images/compact_disc.png"
        }, {
            text: "图例2",
            name: "2",
            icon: "images/compose.png"
        }, {
            text: "图例3",
            name: "3",
            icon: "images/computer-keyboard.png"
        }, {
            text: "图例4-测试-abcdefg",
            name: "4",
            icon: "images/contacts.png"
        }, {
            text: "图例5",
            name: "5",
            icon: "images/contacts-alt.png"
        }, {
            text: "legend6",
            name: "6",
            icon: "images/counter.png"
        }],
        data: [{
                text: "item0405/item0405/A.001",
                imageUrl: "images/counter.png",
                children: [{
                    text: "测试：一个分支时定位不正确",
                    legendName: "1",
                    imageUrl: ""
                }]
            },
            {
                text: "主节点1",
                imageUrl: ["images/counter.png", "images/counter.png"],
                children: [{
                    text: "1-1:图例1-测试-images/compact_disc.png",
                    legendName: "1",
                    imageUrl: ""
                }]
            },
            {
                text: "主节点6"
            }
        ]
    };

    var opt2 = {
        legend: [{
            text: "未分类",
            name: "1",
            icon: "images/compact_disc.png"
        }, {
            text: "上游系统",
            name: "2",
            icon: "images/compose.png"
        }, {
            text: "下游系统",
            name: "3",
            icon: "images/computer-keyboard.png"
        }],
        data: [{
                text: "T017000000000000000000000000",
                children: [{
                    text: "核心-流动性下午供数",
                    legendName: "1",
                    imageUrl: ""
                }, {
                    text: "流动性下午卸数",
                    legendName: "3",
                    imageUrl: ""
                }, {
                    text: "流动性下午卸数3",
                    legendName: "2",
                    imageUrl: ""
                }]
            },
            {
                text: "T02100",
                children: [{
                    text: "核心-调度开始",
                    legendName: "1",
                    imageUrl: ""
                },
                    {
                        text: "核心-调度开始  ",
                        legendName: "1",
                        imageUrl: ""
                    }]


            },
            {
                text: "----时间点"
            }

        ]
    };
    // opt2.theme = {
    //     lengend: {
    //         fill: "#000000",
    //     },
    //     startNode: {
    //         radius: 10,
    //         fill: "#7E899D"
    //     },
    //     endNode: {
    //         radius: 10,
    //         fill: "#7E899D"
    //     },
    //     centralAxisNode: {
    //         height: 21,
    //         radius: 4,
    //         fill: "#1A84CE",
    //         color: "#ffffff",
    //         inner: {
    //             fill: "#1A84CE",
    //             "stroke-width": 0,
    //             stroke: "#1A84CE"
    //         },
    //         outer: {
    //             fill: "#1A84CE",
    //             "stroke-width": 3,
    //             stroke: "#1A84CE"
    //         }
    //     },
    //     centralAxisLine: {
    //         fill: "#7E899D"
    //     },
    //     centralAxisBranchNode: {
    //         fill: "#F9BF3B",
    //         radius: 10
    //     },
    //     centralAxisBranchLine: {
    //         stroke: '#F9BF3B',
    //         fill: "#F9BF3B"
    //     },
    //     centralAxisBranchContent: {
    //         fill: "#F9BF3B",
    //         color: "#ffffff",
    //         stroke: '#ffffff',
    //         height: 24
    //     }
    // }

    opt1.legend = null;

    var theme = 'default';

    // var opt3 = {
    //     legend: [],
    //     data: [{
    //             text: "主节点1",
    //             children: []
    //         },
    //         {
    //             text: "主节点2"
    //         },
    //         {
    //             text: "主节点3",
    //             children: []
    //         },
    //         {
    //             text: "主节点4"
    //         }
    //     ]
    // };

    //opt2.data = [];

    $("#demo").timeline(opt2);

    $("#reload").click(function () {

        if (theme === 'default') {
            theme = 'custom';
        } else {
            theme = 'default';
        }

        // theme === 'default' ? $("#demo").timeline(opt1) : $("#demo").timeline(opt1);
    });




});